package cn.life.common.dao.impl;

import cn.life.common.dao.CommonDao;
import cn.life.common.support.jdbc.AbstractSupportDao;
import org.springframework.stereotype.Repository;

/**
 * @Description:    通用Dao实现层
 *
 * @Author 李佳明
 * @Date 2018/7/18 0018 下午 1:23
 */
@Repository
public class CommonDaoImpl extends AbstractSupportDao implements CommonDao {

    @Override
    public Long getNextId(String tableName, String idName) {
        String sql = "select max(" + idName + ") as id from " + tableName + " ";
        return queryForObject(sql,Long.class) + 1;
    }
}
